﻿@inject IDataCacheService _dataCacheService

<MTextField Value="@Value" Placeholder="@Placeholder" 
            Label="@Label"
            AppendIcon="@(_show ? "mdi-eye" : "mdi-eye-off")"
            Type="@(_show ? "text" : "password")"
            TValue="string" ValueChanged="OnChanged"
            OnAppendClick="() => _show = !_show">
</MTextField>

@code {
    [Parameter]
    public string Value { get; set; }
    [Parameter]
    public string Placeholder { get; set; }
    [Parameter]
    public string Label { get; set; }
    [Parameter]
    public EventCallback<string> ValueChanged { get; set; }
    private bool _show = false;

    public async Task OnChanged(string text)
    {
        Value = text;
        await ValueChanged.InvokeAsync(text);
    }
}
